<?php
session_start();
if(isset($_SESSION['admin_id'])) {
include "../include/dbFunctions.php";
$id= $_POST['id'];
$name= $_POST['name'];
if ($id==0){
    $period='before';
} else {
    $period ='after';
}
    $query1 = "INSERT INTO track_criteria (track_criteria, track_description)
            VALUES  (
                    '".$name."',
                    '".$period."')";
    $result1 = executeQuery($query1);
    if (($result1!=0)) {
        $_SESSION['mes']="New tracking criteria has been added successfully.";
    } else {
        $_SESSION['mes']="Error! Please try again";
    }
    $link = "trackView.php";

?>
<?php
header("Location: $link");
}else {
    header("Location: ../include/login.html");
}
?>